package com.aspose.cells;

import java.util.ArrayList;

class zair {
   private zoz a = null;
   private zpa b;
   private zast c;
   private ArrayList d;

   zair(zoz var1, zpa var2) {
      this.a = var1;
      this.b = var2;
      this.c = this.a.a.getWorksheets().m();
      this.d = new ArrayList();
   }

   void a(zcfw var1) throws Exception {
      this.f(var1);
      if (!var1.n()) {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && !var1.n()) {
                  if ("commentList".equals(var1.p())) {
                     this.c(var1);
                  } else if ("authors".equals(var1.p())) {
                     this.b(var1);
                  } else {
                     var1.a();
                  }
               } else {
                  var1.a();
               }
            }

            return;
         }
      }
   }

   private void b(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && !var1.n()) {
                  if ("author".equals(var1.p())) {
                     com.aspose.cells.b.a.a.ze.a(this.d, (Object)var1.i());
                  } else {
                     var1.a();
                  }
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void c(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && !var1.n()) {
                  if ("comment".equals(var1.p())) {
                     this.d(var1);
                  } else {
                     var1.a();
                  }
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void d(zcfw var1) throws Exception {
      String var2 = var1.a("ref");
      if (var2 != null && var2.length() != 0) {
         int var3 = zase.C(var1.a("authorId"));
         if (var1.n()) {
            var1.a();
         } else {
            int var4 = this.b.d.getComments().a(var2);
            Comment var5 = this.b.d.getComments().get(var4);
            if (var3 < this.d.size() && var3 >= 0) {
               var5.setAuthor((String)this.d.get(var3));
            }

            var1.d();

            while(true) {
               while(var1.r() != 4) {
                  var1.j();
                  if (var1.r() == 1 && !var1.n()) {
                     if ("text".equals(var1.p())) {
                        this.a(var1, var5);
                     } else {
                        var1.a();
                     }
                  } else {
                     var1.a();
                  }
               }

               var1.h();
               return;
            }
         }
      } else {
         throw new CellsException(6, "Invalid comment element");
      }
   }

   private void a(zcfw var1, Comment var2) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         ArrayList var3 = new ArrayList();
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && !var1.n()) {
                  zqg var4;
                  if ("r".equals(var1.p())) {
                     var4 = this.e(var1);
                     com.aspose.cells.b.a.a.ze.a(var3, (Object)var4);
                  } else if ("t".equals(var1.p())) {
                     var4 = new zqg();
                     String var5 = var1.a("space", (String)null);
                     var1.c("preserve".equals(var5));
                     var4.b = var1.i();
                     var1.c(false);
                     com.aspose.cells.b.a.a.ze.a(var3, (Object)var4);
                  } else {
                     var1.a();
                  }
               } else {
                  var1.a();
               }
            }

            var1.h();
            var2.b().b(new ArrayList());
            StringBuilder var11 = new StringBuilder();
            int var12 = 0;

            for(int var6 = 0; var6 < var3.size(); ++var6) {
               zqg var7 = (zqg)var3.get(var6);
               if (var7.b != null) {
                  int var8 = var7.b.length();
                  FontSetting var9 = new FontSetting(var12, var8, this.b.d.c(), true);
                  Font var10 = null;
                  if (var7.a != null) {
                     var10 = new Font(this.b.d.c(), (Object)null, true);
                     var7.a.a(var10);
                     var9.a(var10);
                  }

                  var12 += var8;
                  var11.append(var7.b);
                  com.aspose.cells.b.a.a.ze.a(var2.b().p(), (Object)var9);
               }
            }

            var2.b().c(com.aspose.cells.b.a.zr.a(var11));
            return;
         }
      }
   }

   private zqg e(zcfw var1) throws Exception {
      if (var1.n()) {
         throw new CellsException(6, "Invalid r element");
      } else {
         zqg var2 = new zqg();
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "rPr".equals(var1.p()) && !var1.n()) {
                  var2.a = zajp.a(var1, this.a.a.getWorksheets(), "rFont");
               } else if (var1.r() == 1 && "t".equals(var1.p()) && !var1.n()) {
                  String var3 = var1.a("space", (String)null);
                  var1.c("preserve".equals(var3));
                  var2.b = var1.i();
                  var1.c(false);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return var2;
         }
      }
   }

   private void f(zcfw var1) throws Exception {
      var1.j();
      if (var1.r() != 1 || !"comments".equals(var1.p())) {
         throw new CellsException(6, "comments root element eror");
      }
   }
}
